#pragma once

#include <Unknwn.h>

class CTestComFactory : public IClassFactory
{
public:
	explicit CTestComFactory();
	~CTestComFactory();

	// 以下继承 IUnknown
	HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObject) override;
	ULONG __stdcall AddRef(void) override;
	ULONG __stdcall Release(void) override;

	// 以下继承 IClassFactory
	HRESULT __stdcall CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppvObject) override;
	HRESULT __stdcall LockServer(BOOL fLock) override;

private:
	// 引用计数
	ULONG			m_refNum;
	// 全局对象数
	static ULONG	g_objNum;
};

